package com.learncloud.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.learncloud.entity.SysMenu;
import com.learncloud.entity.SysRoleMenu;
import com.learncloud.mapper.SysRoleMenuMapper;
import com.learncloud.service.ISysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 系统角色菜单中间表 服务实现类
 * </p>
 *
 * @author yj
 */
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {

    @Autowired
    private SysRoleMenuMapper roleMenuMapper;

    @Override
    public List<SysMenu> findMenusByRoles(List<Integer> roleIds, String isEnable) {
        List<SysMenu> menusByRoles = new ArrayList<>();
        if(roleIds != null && roleIds.size() > 0){
            menusByRoles = roleMenuMapper.findMenusByRoles(roleIds, isEnable);
        }
        return menusByRoles;
    }
}
